const db = require('../../database')

module.exports = function checkName(req, res) {
    const mail = req.query['mail'];
    const sql = 'select username from users where mail = ?';
    db.query(sql, mail, (err, data) => {
        if (err) return res.cc(err);
        if (data.length > 0) {
            return res.cc('mail existed');
        }
        res.cc('mail not existed', 0)
    })
}